package com.longtengyuyun.socke_demo.sock;

import jdk.internal.util.xml.impl.ReaderUTF8;

import java.io.OutputStream;
import java.net.Socket;

/**
 * @author ZhaoYunLong
 * @date 2022/4/14
 * @description
 */
public class SocketClient {

    public static void main(String[] args) {

        try {
            String host = "127.0.0.1";
            int port = 5555;
            Socket socket = new Socket(host, port);

            OutputStream outputStream = socket.getOutputStream();
            String content = "这是一个整包";
            for (int i = 0; i<100;i++) {
                outputStream.write(content.getBytes("utf-8"));
            }

            Thread.sleep(20000);
            outputStream.close();
            socket.close();
        }catch (Exception e) {
            e.printStackTrace();
        }

    }
}
